home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / KB-KEY2$.DMO < prev    next >
Text File  |  1996-07-04  |  4KB  |  58 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-10-01 ╟─╖
  5.  │  │ FILE NAME   KB-KEY2$.DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16. $endif
  17.  
  18. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  19. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  20.  
  21. $INCLUDE "DAS-NB01.INC"
  22. COLOR 7, 0
  23. CLS
  24.  
  25. ? "┌─────────────────────────────────────────────────────────────────
  26. ? "│ fKey2Keyboard% ( ScanCode?, Asci? )
  27. ? "│ fStr2Keyboard? (SEG ANY)
  28. ? "│ fPutKey?       (SEG KeyPress%)
  29. ? "├────────────────────────────────────────────────────────────────────────
  30. ? "│ Sometimes it is a handy thing to be able to put a key press or a whole
  31. ? "│ string into the keyboard buffer. These 2 functions allow you to do that
  32. ? "│ quite easily. fKey2Keyboard% is the antithesis of fINKEY% in that you
  33. ? "│ pass the scancode/asciicode for any one key while fStr2Keyboard? will
  34. ? "│ put up to 16(?) characters in there for you just after it clears the
  35. ? "│ buffer.
  36. ? "└──────────────────────────────────────────────────────────────────────────────
  37.                                                       '┌─────────────────────
  38. I$ = "This is a test"                                 '│ something to load
  39. D$ = "There are ## key presses in the buffer."        '│ our display $
  40. CharsIn? = fStr2Keyboard?( I$ )                       '│ stuff I$
  41. fKey2Keyboard 1, 27                                   '│ stuff <ESC>
  42.                                                       '│
  43. 'fPutKey 27                                           '│ stuff <ESC> but
  44.                                                       '│ but clears keyboard
  45.                                                       '│
  46. PRINT USING D$; CharsIn?                              '│ display char count
  47. PRINT                                                 '│
  48. DELAY 1                                               '│ pause for effect
  49. DO                                                    '│
  50.   G$ = INKEY$                                         '│ read the buffer
  51.   IF G$ = CHR$(027) THEN EXIT LOOP                    '│ exit loop on <esc>
  52.   PRINT G$;                                           '│
  53. LOOP                                                  '│
  54.                                                       '│
  55. PRINT : PRINT                                         '│ next line & skip one
  56. PRINT "<< ALL DONE! >>"                               '│ out of the loop!
  57.                                                       '└─────────────────────
  58.